<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="hibernate.constraint.Constraint"%>
<%@ page import="javax.servlet.http.HttpSession"%>
<%@ page import="java.io.PrintWriter"%>

<%@page import="hibernate.constraint.Constraint"%>
<%@ page import="org.hibernate.SessionFactory"%>
<%@ page import="org.hibernate.Session"%>
<%@ page import="java.util.List"%>
<%@ page import="hibernate.model.*"%>
<%@ page import="hibernate.util.HibernateUtil"%>
<%@ page import="hibernate.method.*"%>

<%
	SessionFactory sessionFactory = HibernateUtil
			.getSessionAnnotationFactory();
	Session s = sessionFactory.openSession();
	s.beginTransaction();
	UserMethods user_m = new UserMethods();
%>

<meta charset="UTF-8">
<div class="container language-select visible-md visible-lg">
	<div class="row">
		<div class="col-md-12">



			<%
				Integer user_id = (Integer) session.getAttribute("user_id");
				response.setContentType("text/html");
				if (user_id != null) {

					User u = user_m.id_to_user(sessionFactory, s, user_id);

					out.print("<form action=\"logoutPanel.jsp\">");
					out.print("Witaj " + u.getName() + " !");
					out.print("<input id=\"logout_submit\" class=\"mainBtn\" type=\"submit\" value=\"Wyloguj\">");
					out.print("</form>");
				} else {
			%>
			<form name="Login" action="../Login" method="POST">
				<label for="username">User Name:</label> <input name="username"
					type="text" class="input" id="username" required
					placeholder="enter your user name" /> <label for="password">Password:</label>
				<input name="password" type="password" class="input" id="password"
					required placeholder="password" /> 
					<input id="login_submit"
					class="mainBtn" type="submit" value="zaloguj"> <br /> <label
					for="tip">Problem z zalogowaniem?</label> <a href="http://localhost:8080/Thesis/index.jsp?page=more&opt=registration">Zarejestruj
					się</a> || <a href="http://localhost:8080/Thesis/index.jsp?page=more&opt=passwordReminder">Zapomniałem hasła</a>

				<%
					}
				%>
			</form>
		</div>
	</div>
</div>